// const geocoder = new T.Geocoder()
// { lng: number; lat: number }
// export function getGeocoderData(coordinate: any, callback: Function) {
//   geocoder.getLocation(coordinate, callback)
// }

export async function getGeocoderData(lat: number, lon: number) {
  if (!lat || !lon) {
    return
  }

  // let address = ''
  const { result } = await fetch(
    `http://api.tianditu.gov.cn/geocoder?postStr={\'lon\':${lon},\'lat\':${lat},\'ver\':1}&type=geocode&tk=337d62ff67c603abe0f6fce62e4752a4`
  ).then((response) => response.json())
  // address = res.result

  return result
}
